package Composite_Pattern.Software;

import Composite_Pattern.Education.AbstractOffice;

import java.util.ArrayList;

// -*-coding:utf-8 -*-
//人员：刘陆鑫
//班级：19软3
//学号；2019110218
public class Windows extends AbstractSoft{
    private ArrayList<AbstractSoft> abstractSofts=new ArrayList<AbstractSoft>();
    private String name;


    public Windows(String name) {
        this.name = name;
    }

    @Override
    public AbstractSoft getChild(int i) {
        return (AbstractSoft)abstractSofts.get(i);
    }
    @Override
    public void add(AbstractSoft soft) {
        abstractSofts.add(soft);
    }

    @Override
    public void Open() {
        System.out.println("**容器名为" + name );
        for (Object obj : abstractSofts) {
            ((AbstractSoft) obj).Open();
        }
    }
}
